# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>

pkgname=python-matrix-common
pkgver=1.3.0
pkgrel=3
pkgdesc="Common code for Synapse, Sydent and Sygnal"
arch=(any)
url="https://github.com/matrix-org/matrix-python-common"
license=('Apache')
depends=('python-setuptools' 'python-pydantic')
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-twisted' 'python-service-identity' 'python-aiounittest' 'python-pip')
source=($pkgname-$pkgver.tar.gz::"https://github.com/matrix-org/matrix-python-common/archive/refs/tags/v$pkgver.tar.gz")
sha512sums=('d08fa11a4156a7c4596ea20709e0fddd1563ef1f4ba763e21a073ba53e1baf58d8de1b60cf0f69c846128cdd6f04788df49765704c8adfde187e8de1dc5ded4e')
b2sums=('dd72a7c5558c2db0ab38f2f544f6ab6926fd037e99cbb774973f08bdc661c1587d3d6883ffc6a9cfcea6942284d4020814c02d56be3746279323fca17490f434')

build() {
	cd "matrix-python-common-$pkgver"
	python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
	cd "matrix-python-common-$pkgver"
	python -m venv --system-site-packages test-env
	test-env/bin/python -m installer dist/*.whl
	PATH="$PWD/test-env/bin:$PATH" test-env/bin/python -m twisted.trial tests
}

package() {
	cd "matrix-python-common-$pkgver"
	python -m installer --destdir="$pkgdir" dist/*.whl
}
